]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
timeLimitsManager: Pass extra transition options as params
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 5 Jun 2025 13:33:16 +0000 (15:33 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 5 Jun 2025 13:42:17 +0000 (15:42 +0200)
Boolean parameters are often harder to grasp, in particular when
there are multiple. So before adding more optional flags to
`_addTransition()`, pass flags as a params object.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3740>

js/misc/timeLimitsManager.js

index dc4590584d1b1fb4a729f156f2dd41520f086bd4..dd189e2853c13ff2af09584db689145cead3bd6c 100644 (file)
@@ -455,7 +455,8 @@ export const TimeLimitsManager = GObject.registerClass({
         }
     }
 
-    _addTransition(oldState, newState, wallTimeSecs, recalculateState = true) {
+    _addTransition(oldState, newState, wallTimeSecs,
+        {recalculateState = true} = {}) {
         this._stateTransitions.push({
             oldState,
             newState,
@@ -542,8 +543,9 @@ export const TimeLimitsManager = GObject.registerClass({
             this._addTransition(
                 entry['oldState'],
                 entry['newState'],
-                entry['wallTimeSecs'],
-                i === history.length - 1);
+                entry['wallTimeSecs'], {
+                    recalculateState: i === history.length - 1,
+                });
             previousWallTimeSecs = entry['wallTimeSecs'];
         }